package plugin

import (
	"Ahq/Models"
	"Ahq/ValiEngine"
)

type DivisorNotBeZero struct {
}

func (r *DivisorNotBeZero) GetName() string {
	return "除数不为零"
}
func (r *DivisorNotBeZero) GetDesc() string {
	return "除数不为零"
}

func (r *DivisorNotBeZero) GetKey() string {
	return "DivisorNotBeZero"
}
func (r *DivisorNotBeZero) GetShow() bool {
	return true
}

func (r *DivisorNotBeZero) Vali(operator byte, operand1 int, operand2 int) bool {

	if operator == Models.Division && operand2 == 0 {
		return false
	}
	return true
}

func init() {
	ValiEngine.RegisterRule("DivisorNotBeZero", new(DivisorNotBeZero))
}
